	//가입승인정보
	function clsClubAdminAgree_Info(){
		this.listData = null;
		this._HTMLDom = null;
		this._init();	
	}
	
	clsClubAdminAgree_Info.prototype = {
		_init: function(){
			var $title = $("section#club_admin_agree>section div.club_agree_txt");
			var $layer = $("section#club_admin_agree>section form");
			this._HTMLDom = {
				"$layer": $layer	
				, "$title": $title
			}	
		}
		, setData: function(thisData){
			this.listData = thisData;
			this.display();
		}
		, display: function(){
			var $layer = this._HTMLDom["$layer"];
			var $title = this._HTMLDom["$title"];
			
			$layer.find("dl.club_agree dd:eq(0)").html(this.listData["가입질문"]);
			
			//누구나 가입
		   if(this.listData["가입유형"] == "N"){
		   		$title.find("p").hide().eq(1).show();
		   		$layer.hide();
		  	}else {
		  		$title.find("p").hide().eq(0).show();
		  		$layer.show();
		  	}
		}
		, $getBtnAccept: function(){
			return this._HTMLDom["$layer"].find("dl.club_agree dd:eq(1) div div a:eq(0)");	
		}
		, $getBtnFail: function(){
			return this._HTMLDom["$layer"].find("dl.club_agree dd:eq(1) div div a:eq(1)");	
		}
	}
	
	//가입승인목록
	function clsClubAdminAgree_List(){
		this.listData = null;
		this.totalCount = null;
		this._HTMDom = null;
		this._init();
	}
	
	clsClubAdminAgree_List.prototype = {
		_init: function(){
			var $layer = $("section#club_admin_agree>section ul.club_join_list");
			var $header = $layer.find(">li:eq(0)");
			this._HTMLDom = {
				"$layer": $layer
				, "$element" : $layer.find(">li:eq(1)")
				, "$header" : $layer.find(">li.la")
			}
			$layer.find(">li:not(:first)").remove();
			
		}
		, setList: function(thisData){
			if(!this.listData) {			
				this.listData = [];	
			}
			this.push(thisData);
		}
		, push: function(thisData){
			var thisClass = this;
			var $element = this._HTMLDom["$element"];			
			var $a = this._HTMLDom["$a"];			
			var $tmp = [];
			
			for(var i=0;i<thisData.length;++i){
				var obj = thisData[i];
				$tmp.push($element.clone(true));				
				$tmp[i].find("label, input").remove();
				$tmp[i].find("div.nickname").before("<label><input type='checkbox' /></label>");
				$tmp[i].find("input, label").checkboxradio();
				$tmp[i].find("div.nickname").html(obj["사용자정보"]["닉네임"]);
				$tmp[i].find("div.date").html(_util.fDateYmd(obj["가입신청일"]));
				$tmp[i].find("div.sub").html(obj["가입질문답변"]);

				this.listData.push(obj);
			}
			
			if(this.listData.length == this.totalCount){
				this.$getMore().hide();
			}else{
				this.$getMore().show();
			}
			
			this.display($tmp);
		}
		, display: function(thisData){
			var $layer = this._HTMLDom["$layer"];
			
			for(var i=0;i<thisData.length;++i){
				$layer.append(thisData[i]);
			}
		}
		, getCheckboxValue: function(){
			var obj = this.$getCheckBoxLayer().find("input:checkbox");
			var userId = "";
			for(var i=1;i<obj.length;i++){
					var objData = this.listData[i-1];
					if(obj.eq(i).prop("checked")){
						if(userId) userId += ",";
						userId += objData["사용자정보"]["아이디"];
					}
			}
			return userId;
		}
		, setReset: function(){
			var $layer = this._HTMLDom["$layer"];
			$layer.find(">li:not(:first)").remove();
			this.listData = null;
		}
		, $getLayer: function(){
			return $("section#club_admin_agree");
		}
		, $getCheckBoxLayer: function(){
			return this._HTMLDom["$layer"];
		}
		, $getMore: function(){
			return $("section#club_admin_agree>section div.btn_more");
		}
	}


	//데이터연동
	function clsComm_ClubAdminAgree(){
		this.adminAgreeList = null;
		this.searchRequest = null;
		this.writeRequest = null;
		this._init();
	}
	clsComm_ClubAdminAgree.prototype = {
		_init: function(){
			this.searchRequest = {
				"페이지": null
				, "총갯수": null
			}
			this.writeRequest = {
				"아이디": null
				, "승인여부": null
			}
		}
		/*---------------------회원 조회---------------------*/
		, getClubAdminAgree: function(){
			var thisClass = this;
			var objJson = new MJson();
			var cm = new ConnectionManager();

			objJson.putClient("userid", _util.getLogin("아이디"));
			objJson.putPub(MJson.PUB.SID, "CL001");
			objJson.putPub(MJson.PUB.SERVICENAME, "getMemberList");
			objJson.putPub(MJson.PUB.LISTCOUNT, 10);
			objJson.putPub(MJson.PUB.CURRPAGENO, this.getSearchRequest("페이지"));
			
			objJson.putParameter("clubSeq", _gf.CLUB_DATA["동호회키"]);
			objJson.putParameter("memberStatus", 1);
			
			cm.requestGet(objJson.getJsonString(), function($jsonData){
				
				var res = $jsonData["msp"]["contents"]["items"];
				thisClass.setSearchRequest("총갯수", $jsonData["msp"]["contents"]["@totalcount"]);
				thisClass.adminAgreeList = [];
				if(res){
					if(!res.length){
						res = new Array(res);	
					}
					
					for(var i=0;i<res.length;++i){
						var obj = res[i];
						thisClass.adminAgreeList.push({
							"동호회키": _util.nvl(obj["clubSeq"])
							, "사용자정보": {
								"아이디": _util.nvl(obj["clubMemberUserInfo"]["userId"])
								, "닉네임": _util.nvl(obj["clubMemberUserInfo"]["nickname"])
								, "이미지": _util.nvl(obj["clubMemberUserInfo"]["path"]) + _util.nvl(obj["clubMemberUserInfo"]["saveFileName"])
							}
							, "회원구분": _util.nvl(obj["memberRoleName"])
							, "게시글수": _util.nvl(obj["myBoardCnt"])
							, "댓글수": _util.nvl(obj["myReplyCnt"])
							, "방문수": _util.nvl(obj["visitCount"])
							, "가입일": _util.nvl(obj["joinDate"])
							, "최종방문일": _util.nvl(obj["memberRoleName"])
							, "정보공개":{
								"휴대폰": "전체공개"
								, "이메일": "전체공개"
								, "추가정보": "전체공개"
							}
							, "가입질문답변": _util.nvl(obj["joinment"])
							, "가입신청일": _util.nvl(obj["requestDate"])
						});
					}
				}
				$(thisClass).trigger("evtFinishClubAdminAgree");
			}, function($err) {
				alert($err);
			});
		}
		/*---------------------가입 승인/거절---------------------*/
		, updateAcceptMember: function(){
			var thisClass = this;
			var objJson = new MJson();
			var cm = new ConnectionManager();

			objJson.putClient("userid", _util.getLogin("아이디"));
			objJson.putPub(MJson.PUB.SID, "CL001");
			objJson.putPub(MJson.PUB.SERVICENAME, "acceptMember");
			
			objJson.putParameter("clubSeq", _gf.CLUB_DATA["동호회키"]);
			objJson.putParameter("userId", this.getWriteRequest("아이디"));
			objJson.putParameter("memberStatus", this.getWriteRequest("승인여부"));
			
			cm.requestGet(objJson.getJsonString(), function(ret){
				var resData = {
					"응답코드": (ret["msp"]["contents"]["serviceResult"]=="00000"?true:false)
					, "메세지": _util.getResultMsg(ret)
				}
				
				$(thisClass).trigger("evtFinishUpdateAcceptMember", resData);
			}, function($err) {
				alert($err);
			});
			
		}
		, getClubAdminAgreeData: function(){
			return this.adminAgreeList;
		}
		, setSearchRequest: function(key, val){
			this.searchRequest[key] = val;
		}
		, getSearchRequest: function(key){
			return this.searchRequest[key];
		}
		, setWriteRequest: function(key, val){
			this.writeRequest[key] = val;
		}
		, getWriteRequest: function(key){
			return this.writeRequest[key];
		}
	}
	
	//컨트롤파일
	function ClubAdminAgree(){
		this.club_seq = null;
		
		this.objComm = null;
		this.objClubAdminAgree_List = null;
		this.objClubAdminAgree_Info = null;
	};
	
	ClubAdminAgree.prototype = {
		onPageShow : function() {
			$("a").attr("href", "").attr("data-rel", "");
			this._init();	    		    	
		}
				
		, _beforeStart: function(){
	    	var 	thisClass = this;
	    	
	    	this._permitStart = {
				"동호회정보": false	
			}
			
	  		// 서버 메시지맵
			$.ajax({
				url: "../js/src/club/club_inc.js"
				, type: "get"
				, dataType: "script"
				, async: false
				, success: function(ret, sta){
					//alert("success!!");					
				}
				, error:function(e){
					//alert("error=" + e);
				}	
			});
			
			_cb.getClubInfoData({
				"콜백": function(ret, l){
					thisClass._permitStart["동호회정보"] = true;	
				}
			});
			
			_util.executeThread(function(){
				for(key in thisClass._permitStart){		
					if(!thisClass._permitStart[key]) return false;
				}
				return (true);
			}, function(){			
				thisClass._start();
			});
	   }
		, _init: function(){
	    	
	   		this.objComm = new clsComm_ClubAdminAgree();
	  		this.objClubAdminAgree_Info = new clsClubAdminAgree_Info();
	  		this.objClubAdminAgree_List = new clsClubAdminAgree_List();
	    	
	   		this._beforeStart();
	    	
	   		this.getParam();
	   	
			this._bind();
		}
		, _start: function(){
		  	this.club_info = _cb.getClubInfo();
		   
		   this._role();
		   
		   //동호회정보
		   this.objClubAdminAgree_Info.setData(this.club_info.listData);
		  	
		  	//가입승인목록 조회
		  	this.spinStart();
		  	this.objComm.setSearchRequest("페이지", 1);
		  	this.objComm.getClubAdminAgree();
		}
		, _bind: function(){
			var thisClass = this;
			
			$(this.objComm).bind("evtFinishClubAdminAgree", function(event){
				var listData = thisClass.objComm.getClubAdminAgreeData();
				thisClass.objClubAdminAgree_List.totalCount = thisClass.objComm.getSearchRequest("총갯수");
				thisClass.objClubAdminAgree_List.setList(listData);
				thisClass.spinEnd();
			});
			
			//동호회 가입 승인/거절 완료 이벤트
			$(this.objComm).bind("evtFinishUpdateAcceptMember", function(event, resData){
				alert(resData["메세지"]);
				thisClass.objClubAdminAgree_List.setReset();
				thisClass.objComm.setSearchRequest("페이지", 1);
				thisClass.objComm.getClubAdminAgree();
			})
			
			//동호회정보 화면으로 이동
			this.objClubAdminAgree_List.$getLayer().find("footer ul li:eq(0) a").click(function(event){
				$.mobile.changePage("club_control.html", "slide", true);
			});			
			
			//가입승인 화면으로 이동
			this.objClubAdminAgree_List.$getLayer().find("footer ul li:eq(1) a").click(function(event){
				$.mobile.changePage("club_agree.html", "slide", true);
			});
			
			//동호회 쪽지 화면으로 이동
			this.objClubAdminAgree_List.$getLayer().find("footer ul li:eq(2) a").click(function(event){
				$.mobile.changePage("club_letter.html", "slide", true);
			});
			
			//더보기 버튼 이벤트
			this.objClubAdminAgree_List.$getMore().find("button").click(function(event){
				thisClass.spinStart();
				thisClass.objComm.setSearchRequest("페이지", (thisClass.objComm.getSearchRequest("페이지")+1));
				thisClass.objComm.getClubAdminAgree();
			});
			
			//전체선택 체크박스 클릭 이벤트
			this.objClubAdminAgree_List.$getCheckBoxLayer().find(">li.la input:checkbox").click(function(event){
				var obj = thisClass.objClubAdminAgree_List.$getCheckBoxLayer().find("input:checkbox");
				var idx = obj.index($(this));
				
				if(obj.length > 1){
					if($(this).attr("checked")){
						obj.prop("checked",true);
					}else{
						obj.prop("checked",false);
					}
					obj.checkboxradio("refresh");
				}
			});
			
			//가입승인 버튼 이벤트
			this.objClubAdminAgree_Info.$getBtnAccept().click(function(event){
				var obj = thisClass.objClubAdminAgree_List.getCheckboxValue();
				if(!obj){
					alert("가입승인 회원을 선택 하시기 바랍니다.");
					return;
				}
				thisClass.spinStart();
				thisClass.objComm.setWriteRequest("아이디", obj);
				thisClass.objComm.setWriteRequest("승인여부", "0");
				thisClass.objComm.updateAcceptMember();
			});
			
			//가입거절 버튼 이벤트
			this.objClubAdminAgree_Info.$getBtnFail().click(function(event){
				var obj = thisClass.objClubAdminAgree_List.getCheckboxValue();
				if(!obj){
					alert("가입거절 회원을 선택 하시기 바랍니다.");
					return;
				}
				thisClass.spinStart();
				thisClass.objComm.setWriteRequest("아이디", obj);
				thisClass.objComm.setWriteRequest("승인여부", "7");
				thisClass.objComm.updateAcceptMember();
			});
			
			//메뉴
		 	$("section#club_admin_agree nav ul li a:eq(0)").click(function(event){
		 		event.preventDefault();
		 		thisClass.goNavi();
		 	});
		 	
		 	//알림
		 	$("section#club_admin_agree nav ul li:eq(1)").click(function(event){
		 		event.preventDefault();
		 		$.mobile.changePage("../inc/info_booking.html","slide",true);	
		 	});
			
			//이전
		 	$("section#club_admin_agree header div.top_title_G div.top_left a.btn2").click(function(event){
		 		event.preventDefault();
		 		_gf.CLUB_DATA = {
					"동호회키": thisClass.club_seq	
				}
		 		$.mobile.changePage("self_club.html","slide",true);	
		 	});
		}
		, getParam: function(){
	   		this.club_seq = _gf.CLUB_DATA["동호회키"];
		}
	  , _role: function(){
			if(!this.club_info.isMember()){
    			alert(this.club_info.getError());
    			_gf.CLUB_DATA = {
    				"동호회키": this.club_seq	
    			}
    			$.mobile.changePage("self_club.html","slide",true);
    			return;
    		}else if(!this.club_info.isAdmin()){
    			alert(this.club_info.getError());
    			_gf.CLUB_DATA = {
    				"동호회키": this.club_seq	
    			}
    			$.mobile.changePage("self_club.html","slide",true);
    			return;	
    		}
	  }
		, goNavi: function(){			
			$.mobile.changePage("../inc/navi.html","slide",true);
		}
		, spinStart: function(){		
			$.mobile.showPageLoadingMsg();			
		}
		, spinEnd: function(){			
	 		$.mobile.hidePageLoadingMsg();				
		}
	}